Skip to content

feat: transaction text prop#471

Merged
Klakurka merged 4 commits intomasterfrom
feat/transaction-text
May 22, 2025
Merged

feat: transaction text prop#471
Klakurka merged 4 commits intomasterfrom
feat/transaction-text

Conversation

@lissavxo
Copy link
Collaborator

Related to #270

Description

Added the transaction-text prop. The transaction-text will be displayed in the widget when a transaction occurs, but the amount does not match the required amount, preventing a success message.

Test plan

  • Add transaction-text prop in a paybutton and widget
  • Test transact-text in paybutton generator

@Klakurka Klakurka requested a review from chedieck March 19, 2025 01:56
@lissavxo lissavxo requested a review from Klakurka March 19, 2025 13:35
@lissavxo lissavxo force-pushed the feat/transaction-text branch from 6524dc6 to 658e370 Compare March 19, 2025 19:50
Copy link
Member

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Can you update one of the examples in the demo page to use this? Perhaps on the XEC 'Purchase' button that already has a success-text set.
  • Let's go ahead and open a PR on the server to get the button generator updated. We can update the wordpress plugin later.

setTimeout(() => {
setNewTxText('')
}, 10000)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't really expecting this... I think it's better to stick with the standard toast and perhaps we can make a new task to better differentiate them so people don't mistakenly think they paid the full correct amount when they did not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought - @chedieck thoughts on this? Maybe John also has some ideas how best to visually communicate the custom message while also making it clear that less than the full amount was paid.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call it "Unexpected payment" or something like that by default? Probably some other more precise adjective would be better.

As for the PR, this 10000 should be a constant instead of a hardcoded number.

setTimeout(() => {
setNewTxText('')
}, 10000)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call it "Unexpected payment" or something like that by default? Probably some other more precise adjective would be better.

As for the PR, this 10000 should be a constant instead of a hardcoded number.

Copy link
Member

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to send the wrong amount to a widget and wasn't able to get the tx to appear. I even entered the op_return_raw for it but still nothing.

if (transactionText){
enqueueSnackbar(
`${
transactionText ? transactionText : 'New transaction'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be set by default.

Let's keep the old behaviour (of no toast) if it's not set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is already set to only trigger the toast if there is a transaction text set

docs/README.md Outdated

## transaction-text

> **The ‘transaction-text’ parameter specifies the text displayed when a new transaction occurs.**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's clarify that it's displayed when a new transaction is received that doesn't have the correct amount & OP_RETURN code.

On BCH we just check that it's the correct amount as OP_RETURN is not really supported well on the wallet side.


## transaction-text

> **“transaction-text” 参数指定在新交易发生时显示的文本。**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update as needed.


## transaction-text

> **"transaction-text" 參數指定在新交易發生時顯示的文字。**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update as needed.

@Klakurka
Copy link
Member

Klakurka commented Apr 8, 2025

We'll be adding support for BIP 70 in the near future so this feature may end up being obsolete in most cases.

@lissavxo lissavxo requested review from Klakurka and chedieck April 9, 2025 16:34
@lissavxo lissavxo force-pushed the feat/transaction-text branch from 8492963 to 8a67599 Compare April 9, 2025 17:19
@Klakurka
Copy link
Member

Conflicts.

@lissavxo lissavxo force-pushed the feat/transaction-text branch from 8a67599 to fa9f2d1 Compare April 17, 2025 16:58
@lissavxo
Copy link
Collaborator Author

Conflicts.

resolved

Copy link
Collaborator

@chedieck chedieck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing is appearing to me now.

Tried with

    <div class="paybutton" to="ecash:qq3zv9s3jna6x5t0fxzfgd2zwteqyyjrscf9zmthz7" text="Mine" amount="21"
      currency="XEC" goal-amount="1000" success-text="WOW!" on-close="myClose" on-open="myOpen"
      on-success="mySuccessFunction" on-transaction="myTransactionFunction" 
                                                                            transaction-text="fooo"></div>

@lissavxo lissavxo force-pushed the feat/transaction-text branch from fa9f2d1 to 3dba7d9 Compare April 30, 2025 14:23
Copy link
Collaborator

@chedieck chedieck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working well

Copy link
Member

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually couldn't get this to work.

My steps:

  1. Update dev/demo/index.html, adding transaction-text="partial payment" to the Basic button.
  2. Open http://localhost:10001/
  3. Click the Basic button to open the QR code.
  4. Click the QR code to copy the BIP21 URI. Paste the URI somewhere and edit out the amount. Copy the URI without the amount.
  5. Open https://cashtab.com/ and paste the URI into the address field.
  6. Enter an amount of 8 (or something that isn't 10).
  7. Click Send.

When I follow these steps, nothing happens.

@Klakurka Klakurka merged commit e0bb16c into master May 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants